Skip to content

Conversation

ashishkumarrai1998
Copy link

Reason for change: moved the updateAVoutputTVParam to thread if sync/reset
Test Procedure: as per JIRA
Risks: None
Priority: P1

@ashishkumarrai1998 ashishkumarrai1998 requested a review from a team as a code owner July 16, 2025 09:55
Reason for change: moved the updateAVoutputTVParam to thread if sync/reset
Test Procedure: as per JIRA
Risks: None
Priority: P1
Signed-off-by: Ashish Rai <[email protected]>
@ashishkumarrai1998 ashishkumarrai1998 force-pushed the feature/RDKTV-37684_updateAVoutputparams_logic_change branch from d528dc1 to cd9c306 Compare July 16, 2025 11:58
@utkarshece14 utkarshece14 requested a review from Copilot July 18, 2025 14:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the updateAVoutputTVParam method to implement conditional threading logic based on current TV settings. When the current picture mode, source, and format don't match the requested parameters, the operation is moved to a detached thread for asynchronous execution.

  • Splits the original updateAVoutputTVParam into a wrapper method and an implementation method
  • Adds conditional logic to execute synchronously or asynchronously based on current TV state
  • Introduces thread-based execution for mismatched parameter scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
AVOutputTVHelper.cpp Refactors updateAVoutputTVParam into wrapper and implementation, adds threading logic and current state validation
AVOutputTV.h Adds declaration for new updateAVoutputTVParamImplementation method

retVal = GetCurrentVideoSource(&sourceIndex);
if(retVal != tvERROR_NONE) {
LOGERR("%s : GetCurrentVideoSource( ) Failed\n",__FUNCTION__);
return false;
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function return type is int but returning false (boolean). This should return an integer error code instead.

Suggested change
return false;
return -1;

Copilot uses AI. Check for mistakes.

LOGINFO("Starting thread : %s\n",__FUNCTION__);
std::thread updateAVoutputTVParam_thread(&WPEFramework::Plugin::AVOutputTV::updateAVoutputTVParamImplementation, this, action, tr181ParamName, info, pqParamIndex, level);
updateAVoutputTVParam_thread.detach();

Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When executing in thread mode (else branch), ret remains 0 but the actual operation result is lost since the thread is detached. Consider returning a different value to indicate async execution or implement a callback mechanism.

Suggested change
// Return -1 to indicate asynchronous execution
return -1;

Copilot uses AI. Check for mistakes.

else
{
LOGINFO("Starting thread : %s\n",__FUNCTION__);
std::thread updateAVoutputTVParam_thread(&WPEFramework::Plugin::AVOutputTV::updateAVoutputTVParamImplementation, this, action, tr181ParamName, info, pqParamIndex, level);
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using detached threads without proper lifecycle management can lead to issues if the AVOutputTV object is destroyed while the thread is still running. Consider using a thread pool or ensuring proper cleanup.

Copilot uses AI. Check for mistakes.

//GetCurrent pqmode
if(!getCurrentPictureMode(picMode)) {
LOGERR("Failed to get the current picture mode\n");
}
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation - uses tabs instead of spaces like the rest of the code.

Suggested change
}
}

Copilot uses AI. Check for mistakes.

Comment on lines +1172 to +1173
formatIndex = VIDEO_FORMAT_SDR;
}
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation - uses tabs instead of spaces like the rest of the code.

Suggested change
formatIndex = VIDEO_FORMAT_SDR;
}
formatIndex = VIDEO_FORMAT_SDR;
}

Copilot uses AI. Check for mistakes.

Comment on lines +1172 to +1173
formatIndex = VIDEO_FORMAT_SDR;
}
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation - uses tabs instead of spaces like the rest of the code.

Suggested change
formatIndex = VIDEO_FORMAT_SDR;
}
formatIndex = VIDEO_FORMAT_SDR;
}

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant